package com.aco.party.web.controller.system;

import com.baidu.ueditor.MyActionEnter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * Created by flying on 5/17/2016 0017.
 */
@Controller
@RequestMapping("/ueditor")
public class UEditor {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @RequestMapping("/controller")
    @ResponseBody
    public String enter(HttpServletRequest request){
        InputStream is = null;
        try {

            String basePath = request.getSession().getServletContext().getRealPath("");
            logger.info(basePath);
            String path = basePath + "/WEB-INF/classes/config.json";
            is = new FileInputStream(new File(path));
        }catch (Exception e){
            e.printStackTrace();
        }
        return new MyActionEnter(request,is).exec();
    }
}
